package org.elasticsearch.http;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.transport.BoundTransportAddress;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestRequest;

public interface HttpServerTransport extends LifecycleComponent {

    String HTTP_SERVER_WORKER_THREAD_NAME_PREFIX = "http_server_worker";
    String HTTP_SERVER_BOSS_THREAD_NAME_PREFIX = "http_server_boss";

    BoundTransportAddress boundAddress();

    HttpInfo info();

    HttpStats stats();

    /**
     * Dispatches HTTP requests.
     */
    interface Dispatcher {


        void dispatchRequest(RestRequest request, RestChannel channel);


        void dispatchBadRequest(RestRequest request, RestChannel channel,  Throwable cause);

    }

}
